import java.util.Scanner;

/**
 * Created by forcht on 2018/4/24.
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        StringBuilder s=new StringBuilder();
        s.append(scanner.next());
        int n=scanner.nextInt();
        while (n>0){
            int i=0;
            while (i<s.length()-1&&s.charAt(i)>=s.charAt(i+1)){
                i++;
            }
            s.deleteCharAt(i);
            n--;
        }
        System.out.println(s);
    }
}
